<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/4/4
  Time: 10:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>忽悠你——留言板</title>
    <link rel="stylesheet" href="../style/1.css" type="text/css"></link>
    <script type="text/javascript" src="../js/jquery-1.8.3.js" language="JavaScript"></script>
</head>
<style>
    #zhe {
        width: 100%;
        height: 100%;
        position: fixed;
        background-color: rgba(0, 0, 0, 0.3);
        display: none;
        z-index: 999;
        align-items: center;
    }

</style>
<body>

<div id="zhe">
    <div style="margin: 0 auto; background-color:gainsboro; width: 300px;text-align: center;">
        <p style="font-size: 16px">
            <c:forEach items="${userList}" var="u">
        <table>
            <tr>
                <th>用户名:</th>
                <th>${u.uname}</th>
            </tr>
        </table>

        </c:forEach>
        </p>
        <input type="button" value="关闭" id="col"/>
    </div>

</div>

<h1 id="header"><a href="/">HYN—GuestBook</a></h1>

<p id="sideBar">
<span style="font-size: 15px">当前在线人数有${userList.size()}人&emsp;</span><input type="button" value="查看当前在线用户" id="but">
    <a href="lot">注销</a>
</p>
<ul id="contentList">

    <c:forEach items="${list}" var="t">

        <li>
            <h3>
                标题：<span style="color: blue;font-weight:bolder">${t.ftitle}</span>
                留言人姓名：<span style="color: red;font-weight:bolder">${t.uid.uname}</span>
                留言时间：<span>${t.ftime}</span>


                <c:if test="${user.uname eq t.uid.uname}">
                    <span><a href="uet?mid=${t.fid}" style="font-weight:bold" name="bian">编辑</a></span>
                </c:if>


                <span><a href="srs?wid=${t.fid}" style="font-weight:bold">回复</a></span>

            </h3>
            <div>
                    ${t.fcontext}
                <c:if test="${not empty t.fpic and  '' ne t.fpic}">
                    <img src="fil/${t.fpic}" alt="" id="pics">
                </c:if>

                <div class="ni" style="display:none;background-color: papayawhip">
                    <hr>
                    <c:forEach items="${list1}" var="r">
                        <c:if test="${not empty r.hcontext and  r.hcontext ne '' and r.fid.fid eq t.fid}">
                            回复人:<span style="color: red;font-weight:bolder">${r.uid.uname}</span><br/>
                            回复时间:<span>${r.htime}</span><br/>
                            回复内容:${r.hcontext}<br/>
                            <c:if test="${not empty r.hpic and  '' ne r.hpic}">
                                <img src="fil/${r.hpic}" alt="" id="pics">
                            </c:if>
                            <hr>
                        </c:if>
                    </c:forEach>
                </div>
                </br> <input type="button" value="查看回复" class="a" style="border: 0px;cursor:pointer;color: blue"/>
                <script>
                    $(function () {
                        $(".a").click(function () {
                            $(this).prev().prev().toggle();
                        })

                        $("#but").click(function () {
                            $("#zhe").attr("style", "display:flex");
                        })

                        $("#col").click(function () {
                            $("#zhe").attr("style", "display:none");
                        })
                    })

                </script>
            </div>
        </li>
    </c:forEach>


    <h3 class="page">
        第${index}页/共${tto}页
        <a href="pag?pageIndex=1">首页</a> ||


        <a href="pag?pageIndex=${index-1}">上一页</a>


        <a href="pag?pageIndex=${index+1}">下一页</a>||


        <a href="pag?pageIndex=${tto}">末页</a>
    </h3>

</ul>
<form id="fm1" action="add" enctype="multipart/form-data" method="post">
    <h3><a href="#">Top</a>发表留言</h3>
    <label>留言标题：<input type="text" name="title"/></label>
    <label>您的姓名：<input type="text" name="username" value="${user.uname}" readonly="readonly"/></label>
    <label>留言内容：<textarea name="mcontent"></textarea></label>
    <label>留言图片：<input type="file" name="pic"/></label>
    <input type="submit" value="" id="submitButton"/>
</form>
</body>
</html>
